using MediatR;
using Warehouse.API.Read.App.Commands;
using Warehouse.Dto;
using Warehouse.Services.IServices;

namespace Warehouse.API.Read.App.Handlers
{
    /// <summary>
    /// 调拨出库记录查询处理器
    /// </summary>
    public class TransferOutRecordsQueryHandler : IRequestHandler<TransferOutRecordsQuery, List<TransferOutRecordDto>>
    {
        private readonly IAllocationService _allocationService;

        public TransferOutRecordsQueryHandler(IAllocationService allocationService)
        {
            _allocationService = allocationService;
        }

        public async Task<List<TransferOutRecordDto>> Handle(TransferOutRecordsQuery request, CancellationToken cancellationToken)
        {
            return await _allocationService.GetTransferOutRecordsAsync(request.TransferId);
        }
    }
}
